/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.gu.derp.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Jakob
 */
public class DummyController implements IController {
    private Map<String, Account> accounts = new HashMap<String, Account>();
    private List<Feed> feeds = new ArrayList<Feed>();
    
    public DummyController() {
        accounts.put("u", new Account("u", "p", "a@b.c"));
        accounts.put("u2", new Account("u2", "p2", "x@y.z"));
    }
    
    @Override
    public boolean accountExists(String name) {
        return accounts.containsKey(name);
    }

    @Override
    public Account getAccount(String name) {
        return accounts.get(name);
    }

    @Override
    public void addAccount(Account account) {
        accounts.put(account.getUsername(), account);
    }

    @Override
    public void removeAccount(Account account) {
        accounts.remove(account.getUsername());
    }

    @Override
    public void changePassword(Account account, String password) {
        accounts.get(account.getUsername()).setPassword(password);
    }

    @Override
    public void addFeed(Account account, Feed feed) {
        feeds.add(feed);
    }

    @Override
    public List<Feed> getFeeds(Account account) {
        return new ArrayList<Feed>(feeds);
    }

    @Override
    public void removeFeed(Account account, Feed feed) {
        feeds.remove(feed);
    }
    
}
